<template>
  <div class="share">
    <div class="share-title">分享</div>
    <div class="share-titleOne"></div>
    <div class="share-top">
      <div class="share-top-one">
        <van-grid :column-num="3" :border="false">
          <van-grid-item
            v-for="(item, index) in oneItemList"
            :key="'a' + index"
          >
            <img slot="icon" :src="item.img" alt="" width="39" height="39" />
            <p slot="text">
              {{ item.text }}
            </p>
          </van-grid-item>
        </van-grid>
      </div>
      <div class="share-top-two">
        <div class="share-top-two-title">
          <p class="share-top-two-pone">
            {{ subMemberStatus.today.betweenPush }}
          </p>
          <p class="share-top-two-ptwo">今日推广</p>
        </div>
        <div>
          <p class="share-top-two-pone">
            {{ subMemberStatus.today.directPush }}
          </p>
          <p class="share-top-two-ptwo">今日间推</p>
        </div>
        <div>
          <p class="share-top-two-pone">
            {{
              subMemberStatus.today.betweenPush +
              subMemberStatus.today.directPush
            }}
          </p>
          <p class="share-top-two-ptwo">今日团队新增</p>
        </div>
      </div>
    </div>
    <div class="share-item-one">
      <div class="share-item-one-title">
        <img
          src="../assets/image/icon_share_item7.png"
          width="3px"
          height="19px"
          alt=""
        />
        <p class="share-item-one-span">热门推荐</p>
      </div>
      <div class="xian"></div>
      <div class="itme">
        <div class="itme-one item-ones">
          <img
            src="../assets/image/icon_share_item1.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">海报库</p>
            <p class="p-text">海报素材库</p>
          </div>
        </div>
        <div class="item-xian"></div>
        <div class="itme-one item-ones-two">
          <img
            src="../assets/image/icon_share_item2.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">热文库</p>
            <p class="p-text">助力业务发展</p>
          </div>
        </div>
      </div>
      <div class="xian"></div>
      <div class="itme">
        <div class="itme-one item-ones">
          <img
            src="../assets/image/icon_share_item3.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">朋友圈文案</p>
            <p class="p-text">朋友圈推广</p>
          </div>
        </div>
        <div class="item-xian"></div>
        <div class="itme-one item-ones-two">
          <img
            src="../assets/image/icon_share_item4.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">推广视频</p>
            <p class="p-text">视频素材库</p>
          </div>
        </div>
      </div>
    </div>
    <div class="share-item-one">
      <div class="share-item-one-title">
        <img
          src="../assets/image/icon_share_item7.png"
          width="3px"
          height="19px"
          alt=""
        />
        <p class="share-item-one-span">推广学院</p>
      </div>
      <div class="xian"></div>
      <div class="itme">
        <div class="itme-one item-ones">
          <img
            src="../assets/image/icon_share_item5.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">视频教程</p>
            <p class="p-text">新手教程</p>
          </div>
        </div>
        <div class="item-xian"></div>
        <div class="itme-one item-ones-two">
          <img
            src="../assets/image/icon_share_item6.png"
            alt=""
            width="32"
            height="32"
          />
          <div>
            <p class="p-title">高手经验</p>
            <p class="p-text">经验分享</p>
          </div>
        </div>
      </div>
    </div>
    <div class="share-item-one">
      <div class="share-item-one-title">
        <img
          src="../assets/image/icon_share_item7.png"
          width="3px"
          height="19px"
          alt=""
        />
        <p class="share-item-one-span">我的团队</p>
      </div>
      <div class="share-item-tui">
        <div>
          <p class="share-item-tui-p-one">
            {{ subMemberStatus.all.directPush }}
          </p>
          <p class="share-item-tui-p-two">所有直推</p>
        </div>
        <div>
          <p class="share-item-tui-p-one">
            {{ subMemberStatus.all.betweenPush }}
          </p>
          <p class="share-item-tui-p-two">所有间推</p>
        </div>
        <div>
          <p class="share-item-tui-p-one">
            {{
              subMemberStatus.all.directPush + subMemberStatus.all.betweenPush
            }}
          </p>
          <p class="share-item-tui-p-two">团队总数</p>
        </div>
      </div>
      <!-- end 人数 -->
      <div class="share-item-grade-title">
        <p>等级</p>
        <p>直推</p>
        <p>团队</p>
        <img src="../assets/image/icon_right.png" alt="" width="5" height="9" />
      </div>
      <!-- end title -->
      <div
        class="share-item-grade"
        v-for="(item, index) in MySpreadList"
        :key="'g' + index"
      >
        <p>{{ item.name }}</p>
        <p>{{ item.GradesonIds }}</p>
        <p>{{ item.GradesonIds + item.Gradepreuids }}</p>
        <img src="../assets/image/icon_right.png" alt="" width="5" height="9" />
      </div>
    </div>

    <tabbar />
  </div>
</template>
<script>
import Tabbar from "views/Tabbar.vue";
import { getApiSubMemberStatus, getApiMySpreadInfo } from "../network/ApiServe";
export default {
  name: "Share",
  components: { Tabbar },
  created() {
    this.userId = localStorage.getItem("userId");
    this.token = localStorage.getItem("token");
  },
  data() {
    return {
      oneItemList: [
        {
          img: require("../assets/image/icon_share_item01.png"),
          text: "邀请码",
        },
        {
          img: require("../assets/image/icon_share_item02.png"),
          text: "联系客服",
        },
        {
          img: require("../assets/image/icon_share_item03.png"),
          text: "二维码海报",
        },
      ],
      twoItemList: [
        {
          img: require("../assets/image/icon_share_item1.png"),
          title: "海报库",
          text: "海报素材库",
        },
        {
          img: require("../assets/image/icon_share_item2.png"),
          title: "热文库",
          text: "助力业务发展",
        },
        {
          img: require("../assets/image/icon_share_item3.png"),
          title: "朋友圈文案",
          text: "朋友圈推广",
        },
        {
          img: require("../assets/image/icon_share_item4.png"),
          title: "推广视频",
          text: "视频素材库",
        },
      ],
      subMemberStatus: {
        all: {
          betweenPush: 0,
        },
        today: {
          betweenPush: 0,
        },
        yesterday: {
          betweenPush: 0,
        },
      },
      MySpreadList: [],
    };
  },
  mounted() {
    this.getSubMemberStatus();
    this.getMySpreadInfo();
  },
  methods: {
    getSubMemberStatus() {
      let _this = this;
      getApiSubMemberStatus(_this.userId)
        .then((res) => {
          if ((res.resp_code = "000000")) {
            _this.subMemberStatus = res.result;
            // _this.subMemberStatusList = res.result.today;
          }
          console.log(_this.subMemberStatus, "_this.subMemberStatus");
        })
        .catch((err) => {
          console.log(err, "getApiSubMemberStatus");
        });
    },
    getMySpreadInfo() {
      let _this = this;
      getApiMySpreadInfo(_this.token)
        .then((res) => {
          console.log(res, "getApiMySpreadInfo");
          if (res.resp_code === "000000") {
            res.result.thirdLevelDistribution.filter((item) => {
              if (item.TrueFalseBuy != "4") {
                _this.MySpreadList.push(item);
              }
            });
            console.log(_this.MySpreadList, " _this.MySpreadList");
          }
        })
        .catch((err) => {
          console.log(err, "getApiMySpreadInfo");
        });
    },
  },
};
</script>
<style  scoped>
.share {
  background-color: #f7f7f7;
  padding-bottom: 60px;
}
.share-title {
  text-align: center;
  color: #fff;
  background-color: var(--app-primary-theme-color);
  font-size: 18px;
  line-height: 70px;
  width: 100%;
  position: fixed;
  z-index: 1;
}
.share-top {
  height: 221px;
}
.share-top-one {
  position: relative;
  top: -10px;
  height: 158px;
  background-color: var(--app-primary-theme-color);
}
.share-titleOne {
  height: 70px;
}

.share-top-two {
  position: absolute;
  top: 169.5px;
  height: 100px;
  margin-left: 12px;
  margin-right: 12px;
  width: 351px;
  background-color: #fff;
  border-radius: 9px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  text-align: center;
}
.main {
  margin-top: 50px;
  height: 1000px;
  background-color: #000;
}
.share-top-one >>> .van-grid-item__content--center {
  background-color: var(--app-primary-theme-color);
}
.share-top-one .van-grid-item p {
  color: #fff;
  font-size: 14px;
  margin-top: 9px;
}
.share-top-two-pone {
  color: #121212;
  font-size: 24px;
}
.share-top-two-ptwo {
  margin-top: 10px;
  font-size: 13px;
  color: #616161;
}
.share-item-one {
  margin-left: 12px;
  margin-right: 12px;
  margin-bottom: 12.5px;
  border-radius: 8px;
  background-color: #fff;
}

.share-item-one-span {
  font-size: 16px;
  margin-left: 10px;
  font-weight: 600;
  color: #666;
}
.share-item-one-title {
  display: flex;
  padding-top: 14px;
  padding-bottom: 10px;
  align-items: flex-end;
}
.xian {
  height: 1px;
  background-color: #f7f7f7;
  margin-left: 10px;
  margin-right: 10px;
}
.itme {
  display: flex;
  margin-left: 10px;
  margin-right: 10px;
  height: 80px;
  display: flex;
  align-items: center;
}
.itme-one {
  display: flex;
  flex: 1;
  align-items: center;
}
.item-ones {
  margin-left: 5px;
}
.item-ones-two {
  margin-left: 20px;
}
.item-xian {
  width: 1px;
  height: 38px;
  background-color: #f7f7f7;
}
.itme-one div {
  margin-left: 10px;
}
.p-title {
  font-size: 14px;
  color: #444;
}
.p-text {
  margin-top: 5px;
  font-size: 12px;
  color: #999;
}
.share-item-tui {
  margin-left: 10px;
  margin-right: 10px;
  background-color: #f7f7f7;
  display: flex;
  align-items: center;
  text-align: center;
  height: 104px;
  border-radius: 4px;
}
.share-item-tui div {
  flex: 1;
}
.share-item-tui-p-one {
  font-size: 28px;
  font-weight: 600;
  color: var(--app-primary-theme-color);
}
.share-item-tui-p-two {
  margin-top: 5px;
  font-size: 13px;
  color: #444;
}
.share-item-grade-title {
  height: 60px;
  display: flex;
  align-items: center;
  margin-left: 10px;
  margin-right: 10px;
  text-align: center;
}
.share-item-grade-title p {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: #a3a3a3;
}
.share-item-grade-title img {
  margin-left: 5px;
  margin-right: 5px;
  visibility: hidden;
}
.share-item-grade {
  border-top: 1px solid #f7f7f7;
  height: 44px;
  display: flex;
  align-items: center;
  margin-left: 10px;
  margin-right: 10px;
  text-align: center;
}
.share-item-grade p {
  flex: 1;
  font-size: 14px;
  color: #5d5d5d;
}
.share-item-grade img {
  margin-left: 5px;
  margin-right: 5px;
}
</style>